package n02;

public class S01 {
	public static int sum(int ...n) {//静态方法
		int total=0;
		for (int i : n) {
			total+=i;
		}
		return total;
	}
	public int sum2(int ...n) { //实例方法
		int total=0;
		for (int i : n) {
			total+=i;
		}
		return total;
	}
	public static void main(String[] args) {
		System.out.println(S01.sum(11,22,33)); //通过类型名来调用静态方法
		System.out.println(sum(1,22,333,4444)); //在类的内部调用时刻省略前面的类型.
		int[]ns= {1,2,3,4,5};
		System.out.println(sum(ns));
		System.out.println(sum());
	}
}
